<?php foreach ($this->messages as $message):?>

	<?php $model_from = new Model_User($message->user_from)?>
	<?php echo $this->translate("FROM:") ?>
	<a
	href="<?php
    echo $this->url(array('controller' => $model_from->login, 'action' => null, 'request'=>null),"default")?>"><?php
    echo $model_from->login;
    ?></a>
    
    <a
      <?php if($message->read_check == 0):?>
      style="font-weight: bold;"
 	<?php endif;?>
    
		href="<?php
	    echo $this->url(array('controller' => "message", 'action' => 'message', 'request'=>$message->id),"default")?>"><?php
	   echo str_text($message->message)."..."
	    ?></a>
    
    
	    	<a
		href="<?php
	    echo $this->url(array('controller' => "message", 'action' => 'read', 'request'=>$message->id),"default")?>"><?php
	    echo $this->translate("read/unread");
	    ?></a>
  
 	
	    	<a
		href="<?php
	    echo $this->url(array('controller' => "message", 'action' => 'delete', 'request'=>$message->id),"default")?>"><?php
	    echo $this->translate("Delete");
	    ?></a>
    
	
    <br/>
<?php endforeach;?>


<?php 
//I know, that bad idea, better to store cutted text, but :((
function str_text($text, $counttext = 10, $sep = ' ') {
	$words = split($sep, $text);
	if ( count($words) > $counttext )
		$text = join($sep, array_slice($words, 0, $counttext));
	return $text;
}
?>